import os
import subprocess
import platform


if __name__ == "__main__":
    # List of bag file paths to process

    # folder_path = r"J:\MBZIRC2023\Finals\experiments\tuav6_finals_data\bags"
    # folder_path = r"J:\MBZIRC2023\Finals\experiments\tuav_data_ana"
    folder_path = r"J:\MBZIRC2023\Finals\experiments\uwb_4d_data"
    json_folders = []
    for root, dirs, files in os.walk(folder_path):
        for dir_name in dirs:
            abs_path = os.path.join(root, dir_name)
            print(abs_path)
            json_folders.append(abs_path)
    for json_folder in json_folders:
        for json_file in os.listdir(json_folder):
            if json_file.startswith('nodeframe3') and json_file.endswith('.json'):  # Only process JSON files
                subprocess.run(["python", "test_plot_ranges.py", "--json_folder", json_folder, "--json_file", json_file])
   
    
